home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
datescrn.arc
/
PRT_CTL.C
< prev
next >
Wrap
Text File
|
1985-12-12
|
1KB
|
47 lines
/* prt_ctl() */
/* This function parses the string passed into a series of integers */
/* separated by non-spaces, and sends each integer to the printer as */
/* a printer control sequence. */
#include <ctype.h>
#include <stdio.h>
prt_ctl(prt_code)
char prt_code[];
#define NULL 0
#define SPACE 32
{
extern FILE *f1;
char code[6];
int length, c, num, x, y;
length = strlen(prt_code);
num = y = 0;
setmem(code, 6, NULL);
for (x=0; x <= length; x++) {
if ((c=isdigit(prt_code[x])) > 0) {
code[y] = prt_code[x];
if ((++y) > 5) {
code[y] = NULL;
stcd_i(code, &num);
fprintf(f1, "%c", num);
setmem(code, 6, NULL);
y = 0;
}
} else {
if (prt_code[x] != SPACE) {
if (y > 0) {
code[y] = NULL;
stcd_i(code, &num);
fprintf(f1, "%c", num);
setmem(code, 6, NULL);
y = 0;
}
}
}
}
}